﻿using System;
using System.Collections.Generic;

namespace MinimumSpanningTrees
{
    public class EdgeWeightedGraph
    {
        private int v;//顶点总数
        private int e;//边的总数
        private List<Edge>[] adj;//邻接表

        public EdgeWeightedGraph(int V)
        {
            this.v = V;
            e = 0;
            adj = new List<Edge>[V];
            for (int _v = 0; _v < V; _v++)
            {
                adj[_v] = new List<Edge>();
            }
        }

        public int V()
        {
            return v;
        }

        public int E()
        {
            return e;
        }

        public void AddEdge(Edge edge)
        {
            int v = edge.Either();
            int w = edge.Other(v);

            adj[v].Add(edge);
            adj[w].Add(edge);

            e++;
        }

        public IEnumerable<Edge> Adj(int _v)
        {
            return adj[_v];
        }

        public IEnumerable<Edge> Edges()
        {
            return null;
        }
    }
}
